<template>
  <div class="meiguitu">
    <!-- @click="change"> -->
    <div id="meigui" ref="meigui" style="width: 300px; height: 250px"></div>
  </div>
</template>

<script>
export default {
  name: "JMEIGUITU",
  data() {
    return {};
  },
  mounted() {
    this.dataEcharts();
  },
  computed: {
    rosedata() {
      return this.$store.state.clickeddata;
    },
    newdata() {
      return this.$store.state.clickeddata;
    },
  },
  watch: {
    newdata() {
      this.dataEcharts();
    },
  },
  methods: {
    dataEcharts: function () {
      // console.log(this.rosedata);
      var myChart = this.$echarts.init(this.$refs.meigui);
      myChart.setOption({
        series: [
          {
            type: "pie",
            data: [
              {
                value: this.rosedata.A,
                name: "10-14",
              },
              {
                value: this.rosedata.B,
                name: "14-18",
              },
              {
                value: this.rosedata.C,
                name: "18-25",
              },
              {
                value: this.rosedata.D,
                name: "25-35",
              },
              {
                value: this.rosedata.E,
                name: "35+",
              },
            ],
            radius: ["20%", "60%"],
            roseType: "area",
          },
        ],
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.meiguitu {
  width: 100%;
  float: left;
}
</style>   